/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package maze.levels;

import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.geom.Rectangle2D;
import java.net.URL;
import javax.imageio.ImageIO;
import maze.Game;

/**
 *
 * @author loki
 */
public class Knowledge extends BaseTag {
    private Image tagMark;
    private boolean visited;
    //private String description;
    
    public Knowledge(URL imageURL, String description) throws Exception {
        super(imageURL, description);
        this.visited = false;
        
        this.tagMark = ImageIO.read(new URL(Game.baseURL, "ress/Vink.png"));
    }
    
    /**
     * >;)
     * @return null if already called once, else description
     */
    /*@Override
    public String getDescription() {
        if(!visited) {
            visited = false;
            return description;
        }
        return null;
    }*/
    

    public void setVisisted(boolean visited) {
        this.visited = visited;
    }
    
    @Override
    public void paint(Graphics2D g2d, double x, double y, double scaleX, double scaleY) {
        g2d.drawImage(this.getImage(), (int)(x + 1), (int)(y + 1), (int)(scaleX - 2), (int)(scaleY - 2), null);
        if(visited) {
            g2d.drawImage(this.tagMark, (int)(x + 1), (int)(y + 1), (int)(scaleX - 2), (int)(scaleY - 2), null);
        }
    }
    
    /*public void paintPane(Graphics2D g2d, int width, int height) {        
        // Bepaal de maten van de tekst
        FontMetrics fontMetrics = g2d.getFontMetrics(Game.font);
        Rectangle2D bounds = fontMetrics.getStringBounds(getDescription(), g2d);
        
        int textX = (int)(width - bounds.getWidth()) / 2;
        int textY = 50;
        
        g2d.setFont(Game.font);
        g2d.drawString(getDescription(), textX, textY);
        visited = true;
    }*/
    
    public boolean getVisited() {
        return visited;
    }
}
